package a.g;

import a.c.e;
import a.c.k;
import a.c.m;
import a.c.n;
import a.f.ed;
import a.h.dc;
import a.h.z;
import a.i.db;
import a.i.nb;
import a.i.t;
import a.j.g;
import a.j.ke;

import java.util.HashMap;
import java.util.WeakHashMap;

public class o
  extends h
{
  private g q;
  private n r;
  private n s;
  static final String t = "EDGE_GROUPS";
  static final String u = "CONFIGURATION_METHOD";
  static final String v = "FROM_SKETCH";
  static final String w = "ENTER_MANUALLY";
  static final String x = "AUTOMATIC";
  static final String y = "ALL";
  static final String z = "SELECTED_EDGES";
  static final String A = "SELECTED_NODES";
  static final String B = "GROUP_AT_SOURCE";
  static final String C = "GROUP_AT_TARGET";
  static final String D = "SPHERE_OF_ACTION";
  static final String E = "REMOVE_ALL";
  static final String[] F = { "FROM_SKETCH", "ENTER_MANUALLY", "AUTOMATIC" };
  static final String[] G = { "ALL", "SELECTED_EDGES", "SELECTED_NODES" };
  public static int H;
  
  public o()
  {
    super("EDGE_GROUPS", "yWorks GmbH", "Configures edge group constraints.");
  }
  
  protected dc j()
  {
    dc localdc = new dc(a());
    localdc.a("CONFIGURATION_METHOD", F, 0);
    localdc.b("GROUP_AT_SOURCE", "");
    localdc.b("GROUP_AT_TARGET", "");
    localdc.a("SPHERE_OF_ACTION", G, 0);
    localdc.a("REMOVE_ALL", false);
    z localz = new z(localdc);
    localz.a("REMOVE_ALL", Boolean.FALSE, "CONFIGURATION_METHOD");
    localz.a("REMOVE_ALL", Boolean.FALSE, "GROUP_AT_SOURCE");
    localz.a("REMOVE_ALL", Boolean.FALSE, "GROUP_AT_TARGET");
    localz.a("REMOVE_ALL", Boolean.FALSE, "SPHERE_OF_ACTION");
    return localdc;
  }
  
  protected void n()
  {
    int i = f.p;
    boolean bool = f.o;
    z();
    dc localdc = i();
    if (i == 0)
    {
      if (localdc.g("REMOVE_ALL")) {
        A();
      }
    }
    else {
      return;
    }
    n localn1 = null;
    n localn2 = null;
    String str1 = localdc.h("SPHERE_OF_ACTION");
    if (i == 0) {
      if (str1.equals("ALL"))
      {
        localm = this.q.w();
        if ((i == 0) && (!bool)) {
          break label182;
        }
      }
    }
    if (str1.equals("SELECTED_EDGES"))
    {
      if (i != 0) {
        break label114;
      }
      localm = this.q.S();
      if (!bool) {
        break label182;
      }
    }
    label114:
    localn1 = this.r;
    localn2 = this.s;
    this.r = new a_(this.r, q.a(ke.b(this.q)));
    this.s = new a_(this.s, q.b(ke.b(this.q)));
    m localm = this.q.w();
    label182:
    String str2 = localdc.h("CONFIGURATION_METHOD");
    if (i == 0) {
      if (str2.equals("FROM_SKETCH"))
      {
        a(this.q, localm);
        if ((i == 0) && (!bool)) {
          break label360;
        }
      }
    }
    if ((i != 0) || (str2.equals("ENTER_MANUALLY")))
    {
      String str3 = localdc.h("GROUP_AT_SOURCE");
      if (i == 0) {
        if (str3 != null)
        {
          if (i != 0) {
            break label281;
          }
          if (str3.length() < 1) {
            str3 = null;
          }
        }
      }
      label281:
      String str4 = localdc.h("GROUP_AT_TARGET");
      if (i == 0)
      {
        if (str4 != null)
        {
          if (i != 0) {
            break label339;
          }
          if (str4.length() < 1) {
            str4 = null;
          }
        }
        if (i != 0) {
          break label343;
        }
        a(this.q, localm, this.r, str3, this.s, str4);
      }
      label339:
      if (!bool) {
        break label360;
      }
    }
    label343:
    a(this.q, localm, this.r, this.s, false);
    label360:
    if (localn1 != null)
    {
      this.r = localn1;
      localn1 = null;
      this.s = localn2;
      localn2 = null;
    }
  }
  
  public static void a(g paramg, m paramm, n paramn1, n paramn2, boolean paramBoolean)
  {
    int n = f.p;
    boolean bool = f.o;
    n localn = db.b(new boolean[paramg.l()]);
    if (paramm.e()) {
      localn.a(paramm.a(), true);
    }
    while (n != 0)
    {
      if (n == 0)
      {
        if (bool) {
          break label74;
        }
        paramm.f();
      }
      if (!bool) {
        break;
      }
    }
    label74:
    Object localObject1 = paramg.w();
    do
    {
      while (!bool)
      {
        if (!((m)localObject1).e()) {
          break;
        }
        paramn1.a(((m)localObject1).a(), null);
        paramn2.a(((m)localObject1).a(), null);
        ((m)localObject1).f();
      }
    } while (n != 0);
    localObject1 = new a.i.a.d(paramg);
    a.i.a.d locald = new a.i.a.d(paramg);
    a.c.w localw = paramg.v();
    label272:
    Object localObject2;
    while (localw.e())
    {
      break label288;
      e locale1 = localw.d();
      int k = 0;
      if (bool) {
        break label776;
      }
      m localm2 = locale1.n();
      do
      {
        if (!localm2.e()) {
          break;
        }
        if (bool) {
          break label272;
        }
        if (localn.getBool(localm2.a()))
        {
          if (n != 0) {
            continue;
          }
          if (!localm2.a().g()) {
            k++;
          }
        }
        localm2.f();
      } while (!bool);
      ((a.i.a.d)localObject1).a(locale1, -k);
      if (n == 0)
      {
        int m = 0;
        localObject2 = locale1.m();
        label288:
        do
        {
          if (!((m)localObject2).e()) {
            break label346;
          }
          if (bool) {
            break;
          }
          if (localn.getBool(((m)localObject2).a()))
          {
            if (n != 0) {
              continue;
            }
            if (!((m)localObject2).a().g()) {
              m++;
            }
          }
          ((m)localObject2).f();
        } while (!bool);
        label346:
        locald.a(locale1, -m);
        localw.f();
        if (n == 0) {
          if (bool)
          {
            break label617;
            break label468;
          }
        }
      }
    }
    label373:
    if (n == 0)
    {
      label759:
      do
      {
        if (!((a.i.a.d)localObject1).a())
        {
          if (n != 0) {
            break label769;
          }
          if (!locald.a())
          {
            int i = 0;
            int j = 0;
            if (n == 0) {
              if (!((a.i.a.d)localObject1).a()) {
                j = -((a.i.a.d)localObject1).f();
              }
            }
            if (n == 0) {
              if (!locald.a()) {
                i = -locald.f();
              }
            }
            e locale2;
            m localm3;
            if (i > j)
            {
              locale2 = locald.c();
              localm3 = locale2.m();
              if ((n == 0) && (!localm3.e())) {
                break label373;
              }
              localObject2 = localm3.a();
            }
            do
            {
              do
              {
                if (bool) {
                  break label664;
                }
                if (paramn1.get(localObject2) == null)
                {
                  if (n != 0) {
                    break label600;
                  }
                  if (localn.getBool(localObject2))
                  {
                    if (n != 0) {
                      break label600;
                    }
                    if (!((a.c.d)localObject2).g())
                    {
                      paramn2.a(localObject2, "" + locale2.f());
                      ((a.i.a.d)localObject1).d(((a.c.d)localObject2).e(), ((a.i.a.d)localObject1).b(((a.c.d)localObject2).e()) + 1);
                    }
                  }
                }
                localm3.f();
                if (!bool) {
                  break;
                }
                locale2 = ((a.i.a.d)localObject1).c();
                localm3 = locale2.n();
                if (!localm3.e()) {
                  break label373;
                }
                localObject2 = localm3.a();
                if (n != 0) {
                  break label769;
                }
                if (bool) {
                  return;
                }
              } while (n != 0);
            } while (bool);
            if (paramn2.get(localObject2) == null)
            {
              if (n != 0) {
                break label759;
              }
              if (localn.getBool(localObject2))
              {
                if (n != 0) {
                  break label759;
                }
                if (!((a.c.d)localObject2).g())
                {
                  paramn1.a(localObject2, "" + locale2.f());
                  locald.c(((a.c.d)localObject2).f(), locald.b(((a.c.d)localObject2).f()) + 1);
                }
              }
            }
            localm3.f();
            if (!bool) {
              break;
            }
          }
        }
      } while (n != 0);
      if (paramBoolean)
      {
        m localm1 = paramg.w();
        do
        {
          if (!localm1.e()) {
            break;
          }
          a.c.d locald1 = localm1.a();
          if (n == 0) {
            if (paramn1.get(locald1) != null)
            {
              paramn2.a(locald1, paramn1.get(locald1));
              if (n != 0) {
                continue;
              }
            }
          }
          if ((bool) && ((n != 0) || (paramn2.get(locald1) != null))) {
            paramn1.a(locald1, paramn2.get(locald1));
          }
          localm1.f();
        } while (!bool);
      }
    }
    label468:
    label600:
    label617:
    return;
  }
  
  private void z()
  {
    int i = f.p;
    boolean bool = f.o;
    this.q = e();
    k localk = this.q.c(ed.c);
    if (i == 0)
    {
      if (localk != null) {
        if (i == 0)
        {
          if ((localk instanceof n))
          {
            this.r = ((n)localk);
            if (i != 0) {
              break label101;
            }
          }
        }
        else {
          if (!bool) {
            break label90;
          }
        }
      }
      this.r = db.b(new WeakHashMap());
    }
    else
    {
      this.q.a(ed.c, this.r);
    }
    label90:
    localk = this.q.c(ed.d);
    label101:
    if (i == 0)
    {
      if (localk != null) {
        if (i == 0)
        {
          if ((localk instanceof n))
          {
            this.s = ((n)localk);
            if (i != 0) {
              break label150;
            }
          }
        }
        else if (!bool) {
          return;
        }
      }
      this.s = db.b(new WeakHashMap());
    }
    label150:
    this.q.a(ed.d, this.s);
  }
  
  private void A()
  {
    int i = f.p;
    this.q = e();
    if (i == 0)
    {
      if (this.q.c(ed.c) != null) {
        this.q.j(ed.c);
      }
      if (i != 0) {}
    }
    else if (this.q.c(ed.d) != null)
    {
      this.q.j(ed.d);
    }
    if (i == 0)
    {
      if (this.r != null)
      {
        this.q.a(this.r);
        this.r = null;
      }
      if (i != 0) {}
    }
    else
    {
      if (this.s == null) {
        return;
      }
      this.q.a(this.s);
    }
    this.s = null;
  }
  
  private void a(a.f.o paramo, m paramm)
  {
    int i = f.p;
    boolean bool = f.o;
    n localn;
    HashMap localHashMap;
    do
    {
      localn = db.b(new boolean[paramo.l()]);
      while (!bool)
      {
        if (!paramm.e()) {
          break;
        }
        localn.a(paramm.a(), true);
        paramm.f();
      }
      localHashMap = new HashMap();
    } while (i != 0);
    a.c.w localw = paramo.v();
    label274:
    label409:
    do
    {
      do
      {
        if (!localw.e()) {
          break;
        }
        e locale = localw.d();
        localHashMap.clear();
        m localm = locale.n();
        a.c.d locald1;
        a.d.w localw1;
        a.c.d locald2;
        Object localObject;
        do
        {
          do
          {
            if (!localm.e()) {
              break;
            }
            locald1 = localm.a();
            localw1 = paramo.p(locald1);
            if (bool) {
              break label274;
            }
            if (localn.getBool(locald1))
            {
              if (i != 0) {
                continue;
              }
              if (!localw1.equals(a.d.w.c))
              {
                locald2 = (a.c.d)localHashMap.get(localw1);
                if (i == 0) {
                  if (locald2 != null)
                  {
                    localObject = nb.a(locale, localw1);
                    this.r.a(locald2, localObject);
                    this.r.a(locald1, localObject);
                  }
                }
                localHashMap.put(localw1, locald1);
              }
            }
            localm.f();
          } while (!bool);
          localHashMap.clear();
        } while (i != 0);
        localm = locale.m();
        do
        {
          if (!localm.e()) {
            break label409;
          }
          locald1 = localm.a();
          localw1 = paramo.q(locald1);
          if (bool) {
            break;
          }
          if (localn.getBool(locald1))
          {
            if (i != 0) {
              continue;
            }
            if (!localw1.equals(a.d.w.c))
            {
              locald2 = (a.c.d)localHashMap.get(localw1);
              if (i == 0) {
                if (locald2 != null)
                {
                  localObject = nb.a(locale, localw1);
                  this.s.a(locald2, localObject);
                  this.s.a(locald1, localObject);
                }
              }
              localHashMap.put(localw1, locald1);
            }
          }
          localm.f();
        } while (!bool);
        localw.f();
      } while (i != 0);
    } while (!bool);
  }
  
  private void a(a.f.o paramo, m paramm, n paramn1, Object paramObject1, n paramn2, Object paramObject2)
  {
    boolean bool = f.o;
    do
    {
      if (!paramm.e()) {
        break;
      }
      a.c.d locald = paramm.a();
      paramn1.a(locald, paramObject1);
      paramn2.a(locald, paramObject2);
      paramm.f();
    } while (!bool);
  }
  
  static class a_
    extends t
  {
    n b;
    k c;
    
    a_(n paramn, k paramk)
    {
      this.b = paramn;
      this.c = paramk;
    }
    
    public void a(Object paramObject1, Object paramObject2)
    {
      if ((f.p != 0) || (this.c.getBool(paramObject1))) {
        this.b.a(paramObject1, paramObject2);
      }
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.g.o

 * JD-Core Version:    0.7.0.1

 */